package com.lzyjkz.quick_system.enums.machine;

import lombok.Getter;

@Getter
public enum WarnLevelEnum {
    UNKNOWN(0, "未知"),
    NORMAL(1, "正常"),
    WARN(2, "警告"),
    DANGER(3, "危险"),
    ;

    private final Integer code;
    private final String msg;

    WarnLevelEnum(Integer code, String msg) {
        this.code = code;
        this.msg = msg;
    }

    public static WarnLevelEnum getByCode(Integer code) {
        for (WarnLevelEnum warnLevelEnum : WarnLevelEnum.values()) {
            if (warnLevelEnum.getCode().equals(code)) {
                return warnLevelEnum;
            }
        }
        return null;
    }
}
